<div xmlns:h="http://java.sun.com/jsf/html"
  xmlns:a4j="http://richfaces.org/a4j"
  xmlns:nxu="http://nuxeo.org/nxweb/util"
  xmlns:nxd="http://nuxeo.org/nxweb/document"
  xmlns:c="http://java.sun.com/jstl/core"
  xmlns:f="http://java.sun.com/jsf/core"
  xmlns:nxl="http://nuxeo.org/nxforms/layout"
  xmlns:ui="http://java.sun.com/jsf/facelets">

<h:outputScript target="#{pageJsTarget}">
      function confirmDeleteDirectoryEntry() {
        return confirm("#{messages['label.externalGadget.confirmDelete']}");
      }
</h:outputScript>

<c:set value="command.#{detailMode}"
          var="detailButtonLabel"/>

 <c:if test="#{bean.editableEntry == null and showAddControl == 'true' }">
        <h:form>

          <h4>
            <h:commandLink
              action="#{bean.toggleShowAddForm}">
              <h:graphicImage url="/icons/toggle_plus.png"
                rendered="#{!bean.showAddForm}" />
              <h:graphicImage url="/icons/toggle_minus.png"
                rendered="#{bean.showAddForm}" />
              <h:outputText
                value="#{messages['title.create.entry']}" />
            </h:commandLink>
          </h4>
        </h:form>

        <c:if test="#{bean.showAddForm}">
          <div class="tabsContent">

           <h:form>

            <div class="vocabularyEntryContent">

              <nxl:layout name="#{entryLayoutName}"
                mode="create" value="#{bean.creationEntry}" />

              <div class="buttons">
                <h:commandButton value="#{messages['command.create']}"
                  styleClass="button"
                  action="#{bean.createEntry}" />
                <h:commandButton value="#{messages['command.cancel']}"
                  styleClass="button"
                  action="#{bean.resetCreateEntry}"
                  immediate="true" />
              </div>

            </div>
          </h:form>
          </div>
        </c:if>
 </c:if>

 <c:if test="#{bean.editableEntry != null}">

        <div class="vocabularyEntryContent">
          <h:form>

            <nxl:layout name="#{entryLayoutName}" mode="#{detailMode}"
              value="#{bean.editableEntry}" />
            <div class="buttons">
              <h:commandButton value="#{messages['command.save']}"
                styleClass="button"
                action="#{bean.saveEntry}" rendered="#{detailMode == 'edit'}"/>
              <h:commandButton value="#{messages['command.back']}"
                styleClass="button"
                action="#{bean.resetEditEntry}"
                immediate="true" />
            </div>

          </h:form>

        </div>

 </c:if>

<c:if test="#{bean.editableEntry == null}">

<h:form>

<div class="floatR">
  <h:commandLink action="#{bean.refresh}" styleClass="button">
    <h:outputText value="#{messages['command.refresh']}"/>
  </h:commandLink>
</div>

<table class="dataTable">
  <tbody>
    <nxu:repeat var="entry"
      value="#{bean.entries}" index="index">
      <c:if test="#{index == 0}">
        <nxl:layout name="#{entryLayoutName}" mode="view_list_and_header"
          value="#{entry}" />
      </c:if>
      <c:if test="#{index != 0}">
        <nxl:layout name="#{entryLayoutName}" mode="view_list" value="#{entry}" />
      </c:if>
    </nxu:repeat>
  </tbody>
</table>
</h:form>

</c:if>

</div>
